﻿using System;
using System.Collections.Generic;
using TA.JSON;
using System.Text;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// The result which is output to the client by the <see cref="AutoCompleteExtender.GetSuggestions"/> event.
	/// </summary>
	public class SuggestionResult : IJsonSerializable
	{
		/// <summary>
		/// List of suggestions.
		/// </summary>
		public string[] Suggestions { get; set; }
		#region IJsonSerializable Members
		/// <summary>
		/// Gets true.
		/// </summary>
		public bool IsDirty
		{
			get { return true; }
		}
		/// <summary>
		/// Serializes this as an array.
		/// </summary>
		/// <param name="jw"></param>
		public void Serialize(JsonWriter jw)
		{
			this.SerializeArray(jw);
		}
		/// <summary>
		/// SerializeContents.
		/// </summary>
		/// <param name="jw"></param>
		public void SerializeContents(JsonWriter jw)
		{
			foreach (string s in this.Suggestions)
				jw.Value(s);
		}

		#endregion
	}
}